<!--link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl.WWWROOT_BACKEND; ?>/css/form.css"/-->

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'news-categories-form',
	'enableClientValidation'=>true,
    'htmlOptions'=>array('enctype'=>'multipart/form-data', 'class'=>'form-horizontal'),
    'action'=>Yii::app()->createUrl('/products/manage_product_categories/' . ($model->isNewRecord ? 'create' : 'update/id/' . $_GET['id'])),
)); ?>
	<fieldset>
	<div class="control-group">
		<?php echo $form->labelEx($model,'name', array('class'=>'control-label')); ?>
		<div class="controls">
		<?php echo $form->textField($model,'name',array('size'=>30,'maxlength'=>64)); ?>
		<?php echo $form->error($model,'name'); ?>
        <script type="text/javascript" language="javascript">
            jQuery(document).ready(function() {
                $('#ProductCategories_name').keyup(function(){
                    var value = $('#ProductCategories_name').val();
                    value = value.replace(/[áàảãạăắằẳẵặâấầẩẫậ]/ig, 'a');
                    value = value.replace(/[đ]/ig, 'd');
                    value = value.replace(/[éèẻẽẹêếềểễệ]/ig, 'e');
                    value = value.replace(/[íìỉĩị]/ig, 'i');
                    value = value.replace(/[óòỏõọôốồổỗộơớờởỡợ]/ig, 'o');
                    value = value.replace(/[úùủũụưứừửữự]/ig, 'u');
                    value = value.replace(/[ýỳỷỹỵ]/ig, 'y');
                    value = value.replace(/[^A-Za-z0-9\s_-]/ig, '');
                    value = value.replace(/\s/ig, '-');
                    value = value.toLowerCase();
                    $('#ProductCategories_alias').val(value);
                });
            });
        </script>
		</div>
	</div>

	<div class="control-group">
		<?php echo $form->labelEx($model,'alias', array('class'=>'control-label')); ?>
		<div class="controls">
		<?php echo $form->textField($model,'alias',array('size'=>30,'maxlength'=>64)); ?>
		<?php echo $form->error($model,'alias'); ?>
		</div>
	</div>

	<div class="control-group">
		<?php echo $form->labelEx($model,'image', array('class'=>'control-label')); ?>
		<div class="controls">
		<div style="display:inline-block;">
			<p>
	        	<?php if (isset($model->image)) : ?><img src="<?php echo Yii::app()->createUrl('/') . '/'.$this->module->catalogImg['uri'] . $model->image; ?>" style="max-width:200px;"/><?php endif ?>
			</p>
			<?php echo $form->fileField($model,'image'); ?>
			<?php echo $form->error($model,'image'); ?>
		</div>
		</div>
	</div>
    
  <div class="control-group">
		<?php echo $form->labelEx($model,'description', array('class'=>'control-label')); ?>
		<div class="controls">
		<?php echo $form->textArea($model,'description',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'description'); ?>
		</div>
	</div>

	<div class="form-actions">
        <a class="btn btn-primary" href="<?php echo Yii::app()->createUrl("/products/manage_product_categories/admin"); ?>">Cancel</a>
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array('class'=>'btn btn-primary')); ?>
	</div>
	</fieldset>

<?php $this->endWidget(); ?>
